﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using CamDo.BUL;
using CamDo.DAO;

namespace CamDo
{
    public partial class frmDanhMuc : DevComponents.DotNetBar.RibbonForm
    {
        public frmDanhMuc()
        {
            InitializeComponent();
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            String tenDM = txtTenDM.Text;
            if (Validator.EmptyValue(tenDM))
            {
                eTenDM.Text = "Bạn chưa nhập tên danh mục";
            }
            else
            {
                DanhMucDAO danhmucDAO = new DanhMucDAO();
                danhmucDAO.DanhMucDTO.TenDanhMuc = tenDM;
                if (danhmucDAO.saveARow())
                {
                    eTenDM.Text = "Save Thanh Cong";
                    txtTenDM.Text = "";

                }
                else
                {
                    eTenDM.Text = "Lỗi lưu dữ liệu";
                }

            }
        }

        private void buttonX2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

       
    }
}